home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-03-04 | 2.2 KB | 118 lines | [TEXT/ToyS] |
- -- Preferences
- property kasPrefName : "Hide / Show 1.0"
-
- -- Globals
- global gasInfoWind -- Info window
- global gasInfoPos -- Position of info window
- global gasDid -- Number gone!
- global gasChecked -- Number checked!
- global gasWanted -- What you want
- global gasItems -- Stored list of items we've set invisible
-
-
- on run
- open {}
- end run
-
-
- on open fsObjs
- -- Load prefs, show window
- pfLoad()
-
- if (fsObjs is {}) then
- set fsObjs to gasItems
- set gasItems to {}
- set gasWanted to false -- Invisibility off
- set msg to "Revealing past items…"
- else
- set gasWanted to true -- Make invisible
- set msg to "Hiding selected items…"
- end if
-
- set gasDid to 0
- set gasChecked to 0
-
- set gasInfoWind to display info titled kasPrefName ¬
- located at gasInfoPos ¬
- message msg
-
- -- Do files
- repeat with fsObj in fsObjs
- DoOne(fsObj)
- if gasWanted then
- set gasItems to gasItems & {fsObj}
- pfSave()
- end if
- end repeat
-
- display info gasInfoWind message "DONE (" & msg & ")"
-
- pause for 5 with seconds timing -- Let screen wait...
-
- set gasInfoPos to screen location of ¬
- (display info gasInfoWind with disposal)
-
- pfSave() -- Save window location
- end open
-
-
- on DoOne(fsObj)
- try
- set myInfo to (extended info for fsObj)
- on error
- beep
- return
- end try
-
- display info gasInfoWind ¬
- message "File: " & (catalog name of myInfo) ¬
- at line 2
-
- set gasChecked to gasChecked + 1
-
- set invisible status of myInfo to gasWanted
-
- try
- set the catalog info of fsObj to myInfo
- set gasDid to gasDid + 1
- display info gasInfoWind ¬
- message ("Did: " & gasDid) ¬
- at line 6 ¬
- using color 15 * 32
- on error
- beep
- end try
-
- set myInfo to (extended info for fsObj)
-
- if (invisible status of myInfo) is not gasWanted then
- display info gasInfoWind ¬
- message ("Couldn't change status") ¬
- at line 5 ¬
- using color 15 * 32 * 32
- beep
- end if
-
- display info gasInfoWind ¬
- message ("Checked: " & gasChecked) ¬
- at line 7 ¬
- using color 15
- end DoOne
-
-
- on pfLoad()
- try
- set ourPrefs to (load preference named kasPrefName)
- on error
- set ourPrefs to {{0, 0}, {}}
- end try
-
- set gasInfoPos to item 1 of ourPrefs
- set gasItems to item 2 of ourPrefs
- end pfLoad
-
-
- on pfSave()
- save preference {gasInfoPos, gasItems} named kasPrefName
- end pfSave
-